import { Node } from "cc";
import { ecs } from "db://app-game/libs/ecs/ECS";
import { LittleMonster } from "../../../ecs/little-monster/LittleMonster";

/** 怪兽工厂初始信息参数赋值 */
export interface MonsterInitParams {
  node: Node;
}

/** 关卡怪兽工厂组件 */
@ecs.register("MonsterFactory")
export class MonsterFactoryComp extends ecs.Comp {
  /** 游戏时间 */
  cT: number = 0;
  /** 怪兽工厂节点 */
  node: Node = null;
  /** 当前存活的怪物实例 Map<实例ID, 怪物实例> */
  activeMonsters = new Map<number, LittleMonster>();
  /** 等待复活的怪物队列 */
  respawnQueue = [];

  init(res: MonsterInitParams) {
    this.cT = 0;
    this.node = res.node;
  }

  reset(): void {
    this.cT = 0;
    this.node = null;
  }
}
